/**
 * f-club.cn
 * Copyright (c) 2009-2012 All Rights Reserved.
 */
package com.mtoolkit.serializer.support;

import java.io.IOException;

import com.mtoolkit.serializer.Serializer;
import com.mtoolkit.util.ConversionUtil;

/**
 * JDK serializer implementation.
 * 
 * @author michael
 * @version $Id: JdkSerializer.java, v 0.1 2012-10-17 上午11:37:58 michael Exp $
 */
public class JdkSerializer<T> implements Serializer<T> {

    @Override
    public byte[] serialize(T target) throws IOException {
        return ConversionUtil.object2Bytes(target);
    }

    @Override
    public T deserialize(byte[] bytes) throws IOException, ClassNotFoundException {
        return ConversionUtil.bytes2Object(bytes);
    }

}
